package com.xbongbong.saas.model.impl;

import com.xbongbong.saas.constant.BasicConstant;
import com.xbongbong.saas.domain.dao.OpenAppDao;
import com.xbongbong.saas.domain.entity.OpenAppEntity;
import com.xbongbong.saas.model.OpenAppModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 接口
 * 创建时间 2019/10/9 9:03 PM
 * 修改时间 2019/10/9 9:03 PM
 * @author chy
 * @since v1.1.3
 * @version v1.1.3
 */
@Service("openAppModel")
public class OpenAppModelImpl implements OpenAppModel {

    @Resource
    private OpenAppDao openAppDao;


    @Override
    public Integer insert(OpenAppEntity entity) {
        return null;
    }

    @Override
    public OpenAppEntity getByKey(Long key) {
        return openAppDao.getByKey(key);
    }

    @Override
    public OpenAppEntity getByOpenAppId(Integer openAppId) {

        Map<String, Object> param = new HashMap<>();
        param.put("openAppId", openAppId);
        param.put("del", BasicConstant.ZERO);
        List<OpenAppEntity> list = findEntitys(param);
        return list.isEmpty() ? null : list.get(0);
    }

    @Override
    public List<OpenAppEntity> findEntitys(Map<String, Object> param) {
        return openAppDao.findEntitys(param);
    }
}
